import com.slife.util.Digests;
import com.slife.util.Encodes;
import com.slife.util.EntryptUtils;

public class PasswordTest2 {

    public void MD5Test() throws Exception {
        String encode = EntryptUtils.MD5Encode("admin", "UTF8", true);
        System.out.println();
        System.out.println("MD5算法:"+encode);
    }


    public void aesTest()  {
        String content = "123456";
        String aesKey = "svnadmin";

        byte[] encrypt = EntryptUtils.AESEncrypt(content, aesKey);//加密
        System.out.println("AES加密后-byte[]:"+encrypt);

        String strHex = EntryptUtils.parseByte2HexStr(encrypt);
        System.out.println("转换后的十六进制:"+strHex);


        byte[] decrypt = EntryptUtils.AESDecrypt(EntryptUtils.parseHexStr2Byte(strHex), aesKey);//解密
        System.out.println("AES解密后-byte[]"+decrypt);
        System.out.println("AES解密转换后:"+new String(decrypt));
    }

    public static void main(String[] args) {
        PasswordTest2 pt2 =new PasswordTest2();
        pt2.aesTest();
    }

}
